using System.Collections.ObjectModel;
using System.Data;
using Chaotic.DataBase.DataAccess;
using Chaotic.DataBase.DBAccessLibrary.DBAccessLibrary;
using Chaotic.DataBase.DBAccessLibrary.Model;

namespace Chaotic.DataBase.DBAccessLibrary.Interface;

public interface IOperations
{
	bool CreateDBEntity(ObservableCollection<DataBaseEntity> list, Action<string, int> log, Action<Action> begioninvoke);

	void RollbackTransaction(ConnectionModel? connect);

	void CommitTransaction(ConnectionModel? connect);

	void ConnectDB(ConnectionModel? connect, Action<ConnectionModel?, IDataAccess?> exec, TransactionType transaction = TransactionType.NoTransaction);

	void ConnectDB(ConnectionModel? connect);

	void ExecSql(string? sql, ConnectionModel? connect = null, List<DBParam>? paramlist = null, TransactionType transaction = TransactionType.NoTransaction);

	object? ExecScalar(string? sql, ConnectionModel? connect = null, List<DBParam>? paramlist = null, TransactionType transaction = TransactionType.NoTransaction);

	int ExecNonQuery(string? sql, ConnectionModel? connect = null, List<DBParam>? paramlist = null, TransactionType transaction = TransactionType.NoTransaction);

	DataSet? ExecSqlToDS(string? sql, ConnectionModel? connect = null, List<DBParam>? paramlist = null, TransactionType transaction = TransactionType.NoTransaction);

	DataSet? ExecProc(string? procName, List<DBParam> paramlist, out Dictionary<string, object> outdic, ConnectionModel? connect = null, TransactionType transaction = TransactionType.NoTransaction);

	string IsConnectDB(ConnectionModel? connect);

	DbEntityCache GetDbInfos(ConnectionModel? connection, Action<string, int> log);

	void SaveDescription(TableEntity table, FieldEntity? field, string newChStr, bool isnewTable, TransactionType transaction = TransactionType.NoTransaction);

	List<TypeInfoEntity> GetTypeInfos(ConnectionModel? connection = null);
}
